package com.example.blog.dao;

import com.example.blog.entity.FollowInfo;
import com.example.blog.entity.PostClassInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * @ClassName: psotClassInfo
 * @Description: 收藏管理

 * @Date 2024/2/5
 * @Version 1.0
 */
@Repository
public interface FollowInfoRepository extends JpaRepository<FollowInfo,String>, JpaSpecificationExecutor<FollowInfo> {

    //Page<Map<String, Object>> findByUset(Pageable pageable);
    @Query(nativeQuery = true,value = "select s.* from followInfo s where s.userId = ?1",countQuery = "select count(*) from followInfo s where s.userId = ?1")
    Page<Map> findByUserId(String userId, Pageable pageable);
}
